package WordCount;

public class WordCountMapper implements BaseMapper{

    public void map(String line, BaseContext baseContext) {

        // 按照空格进行分割
        String[] words = line.split(" ");
        for (String word: words){
           Integer value = baseContext.get(word);
           if (value == null){
               baseContext.write(word,1);
           }
           else {
              baseContext.write(word,value + 1);
           }
        }
    }
}
